package com.yohann.designPattern.flyweight;

/**
 * <p>
 * 客户端
 * </p>
 *
 * @author Yohann
 * @since 2021/2/8 15:01
 */
public class Client {
    public static void main(String[] args) {
        WebsiteFactory factory = new WebsiteFactory();
        Website website1 = factory.getWebsiteCategory("news");
        Website website2 = factory.getWebsiteCategory("news");
        Website website3 = factory.getWebsiteCategory("blog");

        //true
        System.out.println(website1 == website2);

        //pony use news website
        website1.use(new User().setName("pony"));

        //2
        System.out.println(factory.getWebsiteSize());
    }
}